<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tjsinfo.tjsoa.common.PageController"%>
<%@page import="com.tjsinfo.tjsoa.mail.vo.TjsemailReceived"%>
<%@page import="com.tjsinfo.tjsoa.system.vo.User"%>
<%@page import="com.tjsinfo.tjsoa.common.ToolKit"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>  
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

User user = ToolKit.getSessionUser(request);
String _order = (String)request.getAttribute("_order");
String _ordertext = "降序";
if("top".equals(_order)){
	_ordertext = "升序";
	_order = "down";
}else{
	_order = "top";
}
String sendUserName = (String)request.getAttribute("sendUserName");
String sendTitle = (String)request.getAttribute("sendTitle");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="<%=basePath%>"/>
    
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath %>email/js/email.js"></script>
	<script >
	function submitmovefold()
	{
		var id = document.getElementsByName('flodname');
		var flodid = document.getElementById('flodid');
		for(var a = 0;a <id.length;a++)
		{
			
			if(id[a].checked == true)
			{
				
				flodid.setAttribute("value",id[a].value);		
			}
		}
		
		document.form1.action = '<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedmove.do'
		document.form1.submit();
		 
	}
	function submitdeletefold()
	{
		var id = document.getElementsByName('flodname');
		var flodid = document.getElementById('flodid');
		for(var a = 0;a <id.length;a++)
		{
			
			if(id[a].checked == true)
			{
				
				flodid.setAttribute("value",id[a].value);		
			}
		}
		if(flodid.getAttribute('value') == '')
		{
			Ext.MessageBox.alert('消息', '请选择文件夹');
			return ;	
		}
		
		document.form1.action = '<%=basePath%>tjsinfo/tjsoa/mail/deleteemailfloder.do'
		document.form1.submit();
		 
	}
	 //分页跳转
	function page2()
	{
			document.form1.action = '<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do'
			document.form1.submit();
	}
	//标题查询  
	//function selecttitle()
	//{
	//	document.selecttitle.action = '<%=basePath%>'
		/*tjsinfo/tjsoa/mail/selectReceivedEmailTitle.do'*/
	//	document.selecttitle.submit();
	//}
	
	function selectUser(){
		Ext.MessageBox.prompt('输入框', '请输入发件人姓名！', function(btn, text) {
			if(btn=='ok'){
		        if(text!='' && text!=null){
					window.location.href = '<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do?sendUserName='+text;
				}else{
					window.location.href = '<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do';
				}
			}
	    });
	}
	
	function selectTitle(){
		Ext.MessageBox.prompt('输入框', '请输入主题！', function(btn, text) {
			if(btn=='ok'){
		        if(text!='' && text!=null){
					window.location.href = '<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do?sendTitle='+text;
				}else{
					window.location.href = '<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do';
				}
			}
	    });
	}
	</script>
	<link href="<%=basePath %>style/txlz7.css" rel="stylesheet" type="text/css" />
	<style >
	.contact_content {
			display: none;
			position: absolute;
			border: 1px solid #FFF;
			border-bottom:none;
			z-index:1800;
			overflow: auto;
		}
		.black_overlays{
			display: none;
			position: absolute;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 450px;
			background-color: #C1EBFC;
			z-index:1002;
			-moz-opacity: 0.8;
			opacity:.80;
			filter: alpha(opacity=30);
		}
	
</style>
<style>
#container {
		    width:600px;
		    height:300px;
		    border:3px solid #c3daf9;
		}
		
.calendar {
    background-image:url(<%=basePath%>images/icon_64.gif) !important;
}

.blist {
    background-image: url(<%=basePath%>images/icon_64.gif) !important;
}

.bmenu1 {
    background-image: url(<%=basePath%>images/mail_111.gif) !important;
}
.bmenu2 {
    background-image: url(<%=basePath%>images/mail_112.gif) !important;
}
.bmenu3 {
    background-image: url(<%=basePath%>images/mail_113.gif) !important;
}
.bmenu4 {
    background-image: url(<%=basePath%>images/mail_115.gif) !important;
}
.menu-title{
    background: #ebeadb url(<%=basePath%>images/icon_64.gif) repeat-x;
    border-bottom:1px solid #99bbe8;
    color:#15428b;
    font:bold 10px tahoma,arial,verdana,sans-serif;
    display:block;
    padding:3px;
}
.lan01{
background: url(<%=basePath%>images/lanbg01.gif) no-repeat 0 0; width:6px; height:24px;} 
.lan02{
background: url(<%=basePath%>images/lanbg02.gif) repeat-x; width:99%; height:24px;}            
.lan03{
background: url(<%=basePath%>images/lanbg03.gif) no-repeat; width:8px; height:24px;}             
.cha{
padding-top:3px}           
</style> 

	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
  </head>
  
  <body style="height: 450px">

	<div id="rightindex"  style="height:450px;">
		<div id="mailcontent" > 
            <div id="mail_title">
                <ul>
                	<li class="over"><a href="javascript:void(0)"><span>收件箱</span></a></li> 
                </ul>
            </div>
            <div id="files" style="display: none;"></div>
            <div id="mail_left" style="height: 91%">
                <div class="p_01">
                    <a  href="<%=basePath %>tjsinfo/tjsoa/mail/emailReceivedList.do" class="a1"><img src="<%=basePath %>images/mailicon03.gif" /></a><a href="<%=basePath %>tjsinfo/tjsoa/mail/writemailfrom.do" class="a2"><img src="<%=basePath %>images/mailicon04.gif" /></a>
                </div>
              <h1>
                </h1>
                <div class="p_02">
                <ul>
                    <li class="l_01"><a href="<%=basePath %>tjsinfo/tjsoa/mail/emailReceivedList.do">收件箱(${count})</a></li><!-- (${count}) -->
                    <li class="l_05"><a href="<%=basePath %>tjsinfo/tjsoa/mail/emailWeiReadReceived.do">未读邮件</a></li>
                    <li class="l_02"><a href="<%=basePath %>tjsinfo/tjsoa/mail/emailDraftList.do">草稿箱</a></li>
                    <li class="l_03"><a href="<%=basePath %>tjsinfo/tjsoa/mail/selectEmaiList.do">已发送</a></li>
                    <li class="l_04"><a href="<%=basePath %>tjsinfo/tjsoa/mail/deleteEmaiList.do">已删除</a></li>
                    <c:forEach var="fold" items="${foldlist}">
                    <li class="l_05"><a href="<%=basePath%>tjsinfo/tjsoa/mail/selectfoldemail.do?id=${fold.folderId}">${fold.folderName}</a></li>
                    </c:forEach>            
                </ul>
                </div>
            </div>
            <div id="mail_right" style="height: 91%">
             <div class="p_11" style="width:100%">
		  	<div id="menu" style="padding-top:3px;height: 91%">
		  		<div style="padding-top:5px;padding-left: 10px"><img src="images/mail2_05.gif"/>&nbsp;<a href="javascript:form1.submit();">删除</a></div>
		  	</div>
	  </div>
	  	<form action="<%=basePath%>tjsinfo/tjsoa/mail/deleteEmailReceived.do" name="form1" method="post">
	     <table class="p_06" width="100%" border="0" cellspacing="0">
          <tr>
            <th width="2%" style="text-align: center">&nbsp;</th>
            <th width="3%" style="text-align: center"><input id="allcheck" type="checkbox" name="checkall" value="checkbox"  onclick="sltall(this.checked)"/></th>
            <th width="3%" style="text-align: center"><img src="images/m_icon25.gif" width="15" height="12" /></th>
            <th width="12%" style="text-align: center">发件人(<a href="javascript:selectUser();">查询</a>)</th>
            <th width="57%" style="text-align: center">主题(<a href="javascript:selectTitle();">查询</a>)</th>
            <th width="12%" style="text-align: center">日期(<a href="<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do?_order=<%=_order %>"><%=_ordertext %></a>)</th>
            <th width="3%" style="text-align: center"><img src="images/m_icon26.gif" width="13" height="11" /></th>
            <th width="8%" style="text-align: center">大小</th>
          </tr>
          
          <c:forEach var="email" items="${list2}">
          	<tr onmouseover="changblockcolor(this,'#D7F6FC')" onmouseout="blackblockcolor(this,'white')">
            <td>&nbsp;</td>
            <td><input type="checkbox" name="checkbox2" value="${email.recId}" /></td>
            <td id="${email.recId}">
            	<c:if test="${email.recStart==1}"><img src="images/m_icon23.gif" alt="未读" width="14" height="13"/></c:if>
            	<c:if test="${email.recStart==2}"><img src="images/m_icon23.gif" width="14" height="13" style="display: none"/></c:if>
            	<!--<c:if test="${email.recType==1}"><img src="images/t.gif" alt="紧急" width="4" height="10"/></c:if>
            	<c:if test="${email.recType==2}"><img src="images/t.gif"  width="4" height="10" style="display: none;"/></c:if>-->
            	<c:if test="${email.recType==3}"><img src="images/hm.gif" alt="缓慢" width="7" height="10"/></c:if>
            	<c:if test="${email.recTag==1}"><img src="images/mail_01.gif" width="11" height="11"/></c:if>
            	<c:if test="${email.recTag==2}"><img src="images/mail_02.gif" width="11" height="11"/></c:if>
            	<c:if test="${email.recTag==3}"><img src="images/mail_03.gif" width="11" height="11"/></c:if>
            	<c:if test="${email.recTag==4}"><img src="images/mail_04.gif" width="11" height="11"/></c:if>
            	<c:if test="${email.recTag==5}"><img src="images/mail_05.gif" width="11" height="11"/></c:if>
            	<c:if test="${email.recTag==0}"><img src="images/mail_03.gif" width="11" height="11"  style="display: none"/></c:if>
            </td>
            <td><c:out value="${email.tjsmail.tjsmailUsername}"></c:out></td>
            <td class="left_txt"><a href="<%=basePath%>tjsinfo/tjsoa/mail/readReceivedMail.do?recid=${email.recId}"><c:out value="${email.tjsmail.tjsmailTitle}"></c:out></a></td>
            <td><fmt:formatDate value="${email.tjsmail.tjsmailDatatime}" pattern="yyyy-MM-dd HH:mm" /></td>
            <td>                       
           	<c:if test="${email.size > 0}">
            	<img src="images/m_icon26.gif" width="13" height="11" />
            </c:if>
            </td>
            <td>
            	<c:set value="0" var="size"></c:set>
            	<c:forEach var="annexe" items="${email.tjsmail.tjsAnnexes}">
            		<c:set value="${size + annexe.annexSize}" var="size"></c:set>
            	</c:forEach>
            	<c:out value="${size}KB"></c:out>	
            </td>
          </tr>
          </c:forEach>
          
          <tr>
            <td colspan="8"><div align="center">
        <%PageController pageController = (PageController)request.getAttribute("pageController");
   		Integer  totalpage =	pageController.getPageCount();
   		out.print("共"+totalpage + "页,"); 
   		out.print("当前为第"+pageController.getCurrentPageNum() + "页,");
   		List list = (List)request.getAttribute("list2");
   		if(pageController.getCurrentPageNum() != 1 && list.size() >0)
   		{
   			int page2 = pageController.getCurrentPageNum(); 
   		%>
   			<a href="<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do?start=up&sendTitle=${sendTitle}&sendUserName=${sendUserName}&page=<%=page2%>">上一页</a>
   		<% 
   		}	
   		
		if(pageController.getCurrentPageNum() != pageController.getPageCount() && list.size() > 0)
   		{
   			int page2 = pageController.getCurrentPageNum(); 
   		%>
   			<a href="<%=basePath%>tjsinfo/tjsoa/mail/emailReceivedList.do?start=down&sendTitle=${sendTitle}&sendUserName=${sendUserName}&page=<%=page2%>">下一页</a>
   		<% 
   		} 		
   		%>
   
   			跳转到<select name="page" onchange="page2()">
   				<%
   					int total = pageController.getPageCount();
   					for(int a =1;a<=total;a++)
   					{
   						if(a == pageController.getCurrentPageNum())
   						{
   				%>
   					<option value="<%=a%>" selected="selected"><%=a%>
   				<% 		
   						}
   						else 
   						{
   				%>
   					<option value="<%=a%>"><%=a%>   				
   				<% 		
   						}
   					}
   		
   				%>
   				
   			</select>页  		          
              </div></td>
            </tr>
        </table>
        <input type="hidden" value="" id="tag"/>
        <input  type="hidden"  name="flodid" value="" id="flodid"/>
        <input type="hidden" value="" id="start"/>
		<input type="hidden" value="" id="type"/>
		<input type="hidden" value="" id="tag"/>
		<input type="hidden" value="<%=basePath %>" id="basepath"/>
		<input type="hidden" value="<%=user.getUser_id() %>" id="userid"/>
        </form>    
            </div>
        
    </div>
</div>

<script type=text/javascript>
Ext.onReady(function(){
	parent.iFrameHeight();
}
);
</script>
                	                
</body>
</html>
